<template>
  <div class="warntable" style="height: 100%;" v-if="ifwarn">
    <div
      :style="{'--titlefont': datatablestyless.titlefontSize,'--px80i': datatablestyless.px80i,'--px40i': datatablestyless.px40i,'--contentfont': datatablestyless.contentfontSize,height: '100%',}"
    >
      <dv-scroll-board :config="config" style="height: 100%;" class="tableconfig" />
    </div>
  </div>
</template>
<script>
import axios from "@/utils/requestzz";;
import defaultmixins from "@/mixins/bigScreen/defaultmixins";

export default {
  name: "datatablewarn",
  mixins: [defaultmixins],
  components: {},
  data() {
    return {
      tableconfigsize: "30px!important",
      ishistory: "实时",
      config: {
        header: [],
        data: [],
        rowNum: 4,
        headerBGC: "#11183C99",
        oddRowBGC: "#040A2199",
        evenRowBGC: "#21284399"
      }
    };
  },
  computed: {
    ifwarn() {
      let showhidearr = this.$store.state.daping.showhidearr;
      if (showhidearr.indexOf("warnpannel") != -1) {
        return true;
      }
      return false;
    }
  },
  watch: {
    "$store.state.daping.queryWarnRec": {
      handler: function(n, o) {
        this.loadData(n);
      }
    }
  },
  mounted() {
    this.config.header = [
      "告警来源",
      "告警内容",
      "异常值",
      "告警等级",
      "生成时间"
    ];
  },
  methods: {
    loadData(pipenetDataObj) {
      let _this = this;

      //异步获取数据
      //setinterval  或者websocket
      //设置option

      //g_queryDBUrl
      this.config.header = [
        "告警来源",
        "告警内容",
        "异常值",
        "告警等级",
        "生成时间"
      ];
      // this.config.header = this.componentDetail.content.header;

      _this.config.data = [];

      let dataa = [];

      // for (let index = 0; index < array.length; index++) {
      //   const element = array[index];

      // }

      let tmp_config = JSON.parse(JSON.stringify(_this.config));
      tmp_config.data = dataa;
      _this.config = tmp_config;
    }
  }
};
</script>
<style lang='scss'>
.warntable {
  pointer-events: none;
}
</style>